/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rmsbean;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Date;

/**
 *
 * @author luis
 */
    
    

public class EventoBean {
    
    public int cod;
    public String login;
    public String descricao;
    public Date data;
    
    public byte[] getBytes() throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(baos);
        dos.writeUTF(login);
        dos.writeUTF(descricao);
        dos.writeUTF(data.toString());
        
        byte[] ret = baos.toByteArray();
        dos.close();
        baos.close();
        
        return ret;
    }
    
    public void setBytes(byte[] valores) throws IOException{
        ByteArrayInputStream bais = new ByteArrayInputStream(valores);
        DataInputStream dis = new DataInputStream(bais);
        this.login = dis.readUTF();
        this.descricao = dis.readUTF();
        
        
        //this.data = dis.readUTF();
        dis.close();
        bais.close();
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public Date getData() {
        return data;
    }

    public void setData(Date data) {
        this.data = data;
    }

    public int getCod() {
        return cod;
    }

    public void setCod(int cod) {
        this.cod = cod;
    }

    

    
    
}
